﻿using SuperMap.Data;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ycjw.PipeLine.Map.Basic.SuperMap
{
    public class Styles
    {
        /// <summary>
        /// 设置GeoText3D的样式
        /// </summary>
        /// <param name="text"></param>
        public static void SetResultTextStyle(GeoText3D text)
        {
            SetResultTextStyleInner(text,Color.Yellow);
        }
        public static void SetResultTextStyle(GeoText3D text,Color color)
        {
            SetResultTextStyleInner(text, color);
        }
        public static void SetResultTextStyle(GeoText3D text, Color color,int fontSize)
        {
            SetResultTextStyleInner(text, color, fontSize);
        }
        private static void SetResultTextStyleInner(GeoText3D text,Color color,int fontSize = 10)
        {
            try
            {
                TextStyle textStyle = new TextStyle
                {
                    ForeColor = color,
                    Outline = true,
                    BackColor = Color.Black,
                    FontHeight = fontSize                    
                };
                text.TextStyle = textStyle;
                GeoStyle3D style = new GeoStyle3D
                {
                    AltitudeMode = AltitudeMode.Absolute
                };
                text.Style3D = style;
            }
            catch (Exception ex)
            {
                Commons.LogHelper.Error(ex.Message);
            }
        }
    }
}
